<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0037)http://localhost:7001/cerp/showAllOrg -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=UTF-8"><LINK 
href="showAllOrg.files/style.htm" rel=stylesheet><LINK 
href="showAllOrg.files/content.htm" rel=stylesheet>
<SCRIPT src="showAllOrg.files/prototype.htm" type=text/javascript></SCRIPT>

<SCRIPT src="showAllOrg.files/util.htm" type=text/javascript></SCRIPT>

<SCRIPT src="showAllOrg.files/msgContainer.htm" type=text/javascript></SCRIPT>

<SCRIPT src="showAllOrg.files/checkInput-noTag.htm" 
type=text/javascript></SCRIPT>

		<script type="text/javascript" src="validation.js"></script>
		
		<script type="text/javascript">
		    var djConfig = {
				isDebug:true,
				parseOnLoad:true,
				usePlainJson:true
		    };
		</script>
		 
		<script type="text/javascript" src="dojo/dojo/dojo.js"></script>
		<script type="text/javascript" src="dojo/dijit/dijit.js"></script>

		<script type="text/javascript">
    		dojo.require("dijit.form.Button");
    		dojo.require("dojo.rpc.JsonService");    	
    	</script>
		
		<script language="JavaScript" type="text/javascript">
			//获得服务
			var orderPlanImportService = new dojo.rpc.JsonService("box/alloc/OrderPlanImportService?smd");

			//验证日期的合法性
			function validate_date(id) {
				if (isDate(document.getElementById(id).value) == false) {
					document.getElementById(id + "_msg").innerHTML = "请输入正确的日期";
					return false;
				} else {
					document.getElementById(id + "_msg").innerHTML = "";
					return true;
				}
			}
			//验证表单合法性
			function validate_order_plan() {
				var res = true;
				var date1, date2;

				//检查是否有数据输入
				if (checkEmpty(document.getElementById("id").value) == true) {
					document.getElementById("id_msg").innerHTML = "此项必填";
					res = false;
				}
				if (checkEmpty(document.getElementById("scd").value) == true) {
					document.getElementById("scd_msg").innerHTML = "此项必填";
					res = false;
				}
				//验证日期合法性
				if (validate_date("start") == false) {
					res = false;
				}
				if (validate_date("end") == false) {
					res = false;
				}
				if (validate_date("cancel") == false) {
					res = false;
				}
				//比较日期先后关系是否符合要求
				date1 = document.getElementById("start").value;
				date2 = document.getElementById("end").value;
				if (compareDate(date1, date2) == 1) {
					document.getElementById("start_msg").innerHTML = "订舱开始时间应在订舱截止时间前！";
					document.getElementById("end_msg").innerHTML = "订舱截止时间应在订舱开始时间后！";
					res = false;
				} else if (compareDate(date1, date2) != 2) {
					document.getElementById("start_msg").innerHTML = "";
					document.getElementById("end_msg").innerHTML = "";
				}
				date1 = document.getElementById("cancel").value;
				if (compareDate(date2, date1) == 1) {
					document.getElementById("end_msg").innerHTML = "订舱截止时间应在退舱截止时间前！";
					document.getElementById("cancel_msg").innerHTML = "退舱截止时间应在订舱截止时间后！";
					res = false;
				} else if (compareDate(date2, date1) != 2) {
					document.getElementById("end_msg").innerHTML = "";
					document.getElementById("cancel_msg").innerHTML = "";
				}
				//检验箱数是否，正整数，总箱数大于等于大箱数
				var total = document.getElementById("total").value;
				var big = document.getElementById("big").value;
				if (isInteger(total) == false) {
					document.getElementById("total_msg").innerHTML = "请输入正整数";
					res = false;
				} else if (checkEmpty(document.getElementById("total").value) == true) {
					document.getElementById("total_msg").innerHTML = "此项必填";
					res = false;
				} else {
					document.getElementById("total_msg").innerHTML = "";
				}
				if (isInteger(big) == false) {
					document.getElementById("big_msg").innerHTML = "请输入正整数";
					res = false;
				} else if (checkEmpty(document.getElementById("big").value) == true) {
					document.getElementById("big_msg").innerHTML = "此项必填";
					res = false;
				} else {
					document.getElementById("big_msg").innerHTML = "";
				}
				if (isInteger(total) == true && isInteger(big) == true) {
					var totalInt = parseInt(total, 10);
					var bigInt = parseInt(big, 10);
					if (totalInt < bigInt) {
						document.getElementById("total_msg").innerHTML = "总箱数应大于等于大箱数";
						document.getElementById("big_msg").innerHTML = "大箱数应小于等于总箱数";
						res = false;
					} else {
						document.getElementById("total_msg").innerHTML = "";
						document.getElementById("big_msg").innerHTML = "";
					}
				}
				return res;
			}
			//导入函数
			function import_order_plan() {
				if(validate_order_plan() == true) {
					orderPlanImportService.post(document.getElementById("id").value,
							document.getElementById("scd").value,
							document.getElementById("start").value,
							document.getElementById("end").value,
							document.getElementById("cancel").value,
							myParseInt(document.getElementById("total").value),
							myParseInt(document.getElementById("big").value),
							myParseInt(document.getElementById("gp20").value),
							myParseInt(document.getElementById("gp40").value),
							myParseInt(document.getElementById("hq40").value)
							).addCallback(import_order_plan_response);
				} else {
					alert("数据有误，请重新输入！");
				}
			}
			//导入操作的响应函数
			function import_order_plan_response(answer) {
				alert(answer);
			}
			//我的parseInt函数
			function myParseInt(value) {
				if (checkEmpty(value)) {
					return -1;
				} else if (!isInteger(value)) {
					return -1;
				} else {
					return parseInt(value);
				}
			}
			//查询函数
			function query_order_plan() {
				orderPlanImportService.query(document.getElementById("id").value,
						document.getElementById("scd").value,
						document.getElementById("start").value,
						document.getElementById("end").value,
						document.getElementById("cancel").value,
						myParseInt(document.getElementById("total").value),
						myParseInt(document.getElementById("big").value),
						myParseInt(document.getElementById("gp20").value),
						myParseInt(document.getElementById("gp40").value),
						myParseInt(document.getElementById("hq40").value)).addCallback(query_order_plan_response);
			}
			//查询响应函数，显示查询结果
			function query_order_plan_response(answer) {
				console.dir(answer);
				//为表格:查询结果，添加一行数据
				function add_query_answer(id, scd, start, end, cancel,
						total, big, small, rowCnt) {
					//tbl：表格，tr：行，td：数据，anchor：链接
					var tbl, tr, td, anchor;

					//得到想要添加行的表格
					tbl = document.getElementById("query_answer");
					//创建一行
					tr = document.createElement("tr");
					if (rowCnt % 2 == 0) {
						tr.className = "gridtreven";
					} else {
						tr.className = "gridtrodd";
					}
					
					td = document.createElement("td");
					td.align = "middle";
					
					anchor = document.createElement("a");
					//设置属性
					anchor.href = "#";
					//直接赋值anchor.onclick = 'alert("bla...ba...")';不好使
					anchor.setAttribute("onclick", 'show_order_plan_details(' + id + ')');
					//将数据加入anchor中
					var icon = document.createElement("img");
					icon.alt = "查看明细";
					icon.src = "showAllOrg.files/view.gif";
					icon.border = "0";
					anchor.appendChild(icon);
					//讲anchor加入td中
					td.appendChild(anchor);
					tr.appendChild(td);
					
					//创建一个数据单元
					td = document.createElement("td");
					//将数据加入到数据单元中
					td.appendChild(document.createTextNode(id));
					//将数据单元加入到行中
					tr.appendChild(td);

					td = document.createElement("td");
					//anchor = document.createElement("a");
					//设置属性
					//anchor.href = "#";
					//直接赋值anchor.onclick = 'alert("bla...ba...")';不好使
				//	anchor.setAttribute("onclick", 'alert("anchor的onclick属性好使！")');
					//将数据加入anchor中
				//	anchor.appendChild(document.createTextNode(scd));
					//讲anchor加入td中
					td.appendChild(document.createTextNode(scd));
					tr.appendChild(td);

					td = document.createElement("td");
					td.appendChild(document.createTextNode(start));
					tr.appendChild(td);

					td = document.createElement("td");
					td.appendChild(document.createTextNode(end));
					tr.appendChild(td);

					td = document.createElement("td");
					td.appendChild(document.createTextNode(cancel));
					tr.appendChild(td);

					td = document.createElement("td");
					td.appendChild(document.createTextNode(total));
					tr.appendChild(td);

					td = document.createElement("td");
					td.appendChild(document.createTextNode(big));
					tr.appendChild(td);

					td = document.createElement("td");
					td.appendChild(document.createTextNode(small));
					tr.appendChild(td);

					//将行加入表格中
					tbl.tBodies[0].appendChild(tr);
				}
				//清空表格函数
				function clear_query_answer() {
					var rows = document.getElementById("query_answer").tBodies[0].rows;
					for (var i = rows.length - 1; i > 0; i--) {
						var rIndex = rows[i].sectionRowIndex;
						rows[i].parentNode.deleteRow(rIndex);
					}
				}

				//在显示查询结果前，先清空之前的查询结果
				clear_query_answer();
				//以参数形式传过来的二维数组可以正常使用
				for (var i in answer.list) {
					add_query_answer(answer.list[i].ID, answer.list[i].shipSchedule.id, answer.list[i].startTimeString,
							answer.list[i].endTimeString, answer.list[i].cancelTimeString, answer.list[i].totalBox, answer.list[i].bigBox,
							parseInt(answer.list[i].totalBox) - parseInt(answer.list[i].bigBox), i);
				}
			}
			//重置查询表
			function reset_order_plan() {
				document.getElementById("id").value = "";
				document.getElementById("scd").value = "";
				document.getElementById("start").value = "";
				document.getElementById("end").value = "";
				document.getElementById("cancel").value = "";
				document.getElementById("total").value = "";
				document.getElementById("big").value = "";
				document.getElementById("gp20").value = "";
				document.getElementById("gp40").value = "";
				document.getElementById("hq40").value = "";
			}
			//显示OrderPlan详情
			function show_order_plan_details(id) {
				//跳转到缮制舱位分配清单页面
				//此处应对id进行转换以使参数形式更广泛				
				//console.dir(id);
				orderPlanImportService.setMakeBoxAllocFormParams(id.toString()).addCallback(function () {
					window.open("预分配计划明细.htm", "_self");
				});
			}
		</script>

</HEAD>

<BODY><FONT style="FONT-SIZE: 18px" face=隶书 color=#3656b9 
;>舱位预分配计划</FONT><BR><IMG src="showAllOrg.files/line2.gif"><BR>

<CENTER><!--查询操作表格-->
<TABLE cellSpacing=0 cellPadding=0 width=560 align=center border=0>
  <TBODY>
  <TR>
    <TD align=right><FONT class=redcolor face=Webdings>4</FONT><A 
      href="javascript:import_order_plan()">导入</A>&nbsp;&nbsp; <FONT class=redcolor face=Webdings>4</FONT><A 
      href="javascript:query_order_plan()">查询</A>&nbsp;&nbsp; <FONT class=redcolor 
      face=Webdings>4</FONT><A href="javascript:reset_order_plan()">重置</A> 
  </TD></TR></TBODY></TABLE><!--数据区form-->
  
<INPUT type=hidden value=1 name=currentPage>
<INPUT type=hidden value=1 name=pageCount> 
<INPUT type=hidden value=query name=opFlag>
<INPUT type=hidden name=query_orgID0> 
<INPUT type=hidden name=currentRow> 

<!--查询条件表格，规定样式为class="queryarea"，注意框架的内容显示区规定了表格的最大width不得超过760，按排版需要可小于760。-->
<TABLE class=queryarea cellSpacing=2 cellPadding=2 width=760 align=center>
  <TBODY>
  <TR>
    <TD class=rtitle>计划编码:</TD>
    <TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      name="id" id="id"><a id="id_msg"></a> </TD>
    <TD class=rtitle>航次:</TD>
    <TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      name="scd" id="scd"><a id="scd_msg"></a> </TD>
  <TR>
    <TD class=rtitle>订舱开始时间(MM/DD/YYYY):</TD>
    <TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      name="start" id="start"><a id="start_msg"></a></TD> 
    <TD class=rtitle>订舱截止时间(MM/DD/YYYY):</TD>
    <TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      name="end" id="end"> <a id="end_msg"></a></TD></TR>
   <TR>
    <TD class=rtitle>退舱截止时间(MM/DD/YYYY):</TD>
    <TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      name="cancel" id="cancel"><a id="cancel_msg"></a> </TD>
    <TD class=rtitle>总箱数:</TD>
    <TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      name="total" id="total"><a id="total_msg"></a> </TD></TR>
      <TR>
      	<TD class=rtitle>大箱数:</TD>
    	<TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      	name="big" id="big"><a id="big_msg"></a> </TD>
      	<TD class=rtitle>箱型GP20:</TD>
    	<TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      	name="gp20" id="gp20"><a id="gp20_msg"></a> </TD>
      </TR>
      <TR>
      	<TD class=rtitle>箱型GP40:</TD>
    	<TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      	name="gp40" id="gp40"><a id="gp40_msg"></a> </TD>
      	<TD class=rtitle>箱型HQ40:</TD>
    	<TD class=ltitle><INPUT class=linput onkeypress="return checkEnter(event)" 
      	name="hq40" id="hq40"><a id="hq40_msg"></a> </TD>
      </TR>
  </TBODY></TABLE><BR>
  
  <!--数据显示区表格，规定样式为class="gridarea" -->
<TABLE id="query_answer" class=gridarea cellSpacing=1 cellPadding=2 width=760 align=center><!--数据行标题-->
  <TBODY>
  <TR>
    <TD class=gridtitletd vAlign="middle" width=100>操作 </TD>
    <TD class=gridtitletd vAlign="middle" width=100>计划编码</TD>
    <TD class=gridtitletd vAlign="middle" width=100>航次</TD>
    <TD class=gridtitletd vAlign="middle" width=150>订舱开始时间</TD>
    <TD class=gridtitletd vAlign="middle" width=150>订舱截止时间</TD>
    <TD class=gridtitletd vAlign="middle" width=150>退舱截止时间</TD>
    <TD class=gridtitletd vAlign="middle" width=100>总箱数</TD>
    <TD class=gridtitletd vAlign="middle" width=100>大箱数</TD>
    <TD class=gridtitletd vAlign="middle" width=100>小箱数</TD>
  </TR>
  <!--数据行内容，样式规定为gridtrodd、gridtreven交替出现，即灰白行交替出现--><!--注意数据行中的input命名规则，一般以对应数据库字段名＋实际序号表示，在JAVA程序中取值时，亦使用同一规则。-->
  </TBODY>
  </TABLE>
<SCRIPT language=javascript>
function nextPage() {
  return;
}
function prevPage() {
  return;
}
function firstPage() {
  return;
}
function lastPage() {
  return;
}
//直接定位时调用
function locate(obj) 
{
  var tmpChar = window.event.keyCode;
  if (tmpChar == 13) 
  {
    var val = parseInt(obj.value);
    if (val>1 || val<1 || isNaN(val))  
    {
      alert("要查询的页面不存在!: " + obj.value);
      obj.value=1;
      return false;
    }
    document.formHidden.currentPage.value= val;
    document.formHidden.submit();
    return false;
  }
  else
  {
     if (tmpChar>47 && tmpChar<58) 
     {  
         return true;
     }  
     return false; 
  }  
}  
</SCRIPT>
</CENTER></BODY></HTML>
